package odgs;

import java.io.Serializable;

public class ContentsFile implements Serializable
{
	private int uid;
	private String nodeId;
	private String name;
	private String type;
	private String path;
	private String ip;
	private long start;
	private long end;
	private int	contentsUID;

	public ContentsFile(int uid, int contentsUID,String id,String name,String type, String path,long start,long end)
	{
		this.uid = uid;
		this.nodeId = id;
		this.name = name;
		this.type = type;
		this.path = path;
		this.start = start;
		this.end = end;
		this.contentsUID = contentsUID;
	}
	
	public void setContentsUID(int contentsUID)
	{
		this.contentsUID = contentsUID;
	}

	public ContentsFile(String id)
	{
		this.nodeId = id;
	}

	public int getUid() 
	{
		return uid;
	}
	
	public void setUid(int uid) 
	{
		this.uid = uid;
	}
	
	public long getEnd()
	{
		return end;
	}

	public void setEnd(long end)
	{
		this.end = end;
	}

	public String getNodeId()
	{
		return nodeId;
	}

	public void setNodeId(String id)
	{
		this.nodeId = id;
	}

	public String getName()
	{
		return name;
	}

	public void setName(String name)
	{
		this.name = name;
	}

	public long getStart()
	{
		return start;
	}

	public void setStart(long start)
	{
		this.start = start;
	}

	public String getType()
	{
		return type;
	}

	public void setType(String type)
	{
		this.type = type;
	}

	public void setPath(String path)
	{
		this.path = path;
	}
	
	public String getPath()
	{
		return path;
	}
	
	@Override
	public boolean equals(Object file)
	{
		if (file instanceof ContentsFile)
		{
			ContentsFile f = (ContentsFile) file;
			if(f.getNodeId().equals(nodeId) && f.getName().equals(name) && f.getPath().equals(path) && f.getType().equals(type) && f.getStart() == start && f.getEnd() == end)
				return true;
			else 
				return false;
		}
		else
		{
			return false;
		}
	}
	
	public String toString()
	{
		return contentsUID + "_" + start + "_" + end + "." + type;
	}
	
	public String getIp()
	{
		return ip;
	}
	
	public void setIp(String ip)
	{
		this.ip = ip;
	}

	public int getContentsUID()
	{
		return contentsUID;
	}
}
